﻿using Abp.Application.Navigation;
using Abp.Authorization;
using Abp.Localization;
using Choucius.Boilerplate9.Authorization;

namespace Choucius.Boilerplate9.Web.Startup
{
    /// <summary>
    /// This class defines menus for the application.
    /// </summary>
    public class Boilerplate9NavigationProvider : NavigationProvider
    {
        public override void SetNavigation(INavigationProviderContext context)
        {
            context.Manager.MainMenu
                .AddItem(
                    new MenuItemDefinition(
                        PageNames.About,
                        L("About"),
                        url: "About",
                        icon: "fas fa-info-circle"
                    )
                )
                .AddItem(
                    new MenuItemDefinition(
                        PageNames.Home,
                        L("HomePage"),
                        url: "",
                        icon: "fas fa-home",
                        requiresAuthentication: true
                    )
                )
                /* 设备管理菜单组（开始） */
                .AddItem( // Menu items below is just for demonstration!
                    new MenuItemDefinition(
                        "DeviceManagement",
                        L("DeviceManagement"),
                        icon: "fas fa-camera"
                    )
                    .AddItem(
                        new MenuItemDefinition(
                            PageNames.Devices,
                            L("Devices"),
                            url: "Devices",
                            icon: "fas fa-desktop",
                            permissionDependency: new SimplePermissionDependency(PermissionNames.Pages_Users)
                        )
                    )
                    .AddItem(
                        new MenuItemDefinition(
                            PageNames.T4000Printers,
                            L("T4000Printers"),
                            url: "T4000Printers",
                            icon: "fas fa-barcode",
                            permissionDependency: new SimplePermissionDependency(PermissionNames.Pages_Roles)
                        )
                    )
                )
                /* 设备管理菜单组（结束） */
                /* 包材管理菜单组（开始） */
                .AddItem( // Menu items below is just for demonstration!
                    new MenuItemDefinition(
                        "PackagingMaterialManagement",
                        L("PackagingMaterialManagement"),
                        icon: "fas fa-cubes"
                    )
                    .AddItem(
                        new MenuItemDefinition(
                            PageNames.PlasticContainerStatistics,
                            L("PlasticContainerStatistics"),
                            url: "PlasticContainerStatistics",
                            icon: "fas fa-line-chart"
                            //requiresAuthentication: true
                        )
                    )
                    .AddItem(
                        new MenuItemDefinition(
                            PageNames.RubberFrameStatistics,
                            L("RubberFrameStatistics"),
                            url: "RubberFrameStatistics",
                            icon: "fas fa-pie-chart"
                            //requiresAuthentication: true
                        )
                    )
                    .AddItem(
                        new MenuItemDefinition(
                            PageNames.PlasticContainers,
                            L("PlasticContainers"),
                            url: "PlasticContainers",
                            icon: "fas fa-cube",
                            requiresAuthentication: true
                        )
                    )
                    .AddItem(
                        new MenuItemDefinition(
                            PageNames.RubberFrames,
                            L("RubberFrames"),
                            url: "RubberFrames",
                            icon: "fas fa-shopping-basket",
                            requiresAuthentication: true
                        )
                    )
                )
                /* 包材管理菜单组（结束） */
                /* 仓库管理菜单组（开始） */
                .AddItem( // Menu items below is just for demonstration!
                    new MenuItemDefinition(
                        "WarehouseManagement",
                        L("WarehouseManagement"),
                        icon: "fas fa-building"
                    )
                    .AddItem(
                        new MenuItemDefinition(
                            PageNames.OutboundTasks,
                            L("OutboundTasks"),
                            url: "OutboundTasks",
                            icon: "fas fa-theater-masks",
                            requiresAuthentication: true
                        )
                    )
                    .AddItem(
                        new MenuItemDefinition(
                            PageNames.InboundPlasticContainerLogs,
                            L("InboundPlasticContainerLogs"),
                            url: "InboundPlasticContainerLogs",
                            icon: "fas fa-sign-in",
                            requiresAuthentication: true
                        )
                    )
                    .AddItem(
                        new MenuItemDefinition(
                            PageNames.OutboundPlasticContainerLogs,
                            L("OutboundPlasticContainerLogs"),
                            url: "OutboundPlasticContainerLogs",
                            icon: "fas fa-sign-out",
                            requiresAuthentication: true
                        )
                    )
                    .AddItem(
                        new MenuItemDefinition(
                            PageNames.InboundRubberFrameLogs,
                            L("InboundRubberFrameLogs"),
                            url: "InboundRubberFrameLogs",
                            icon: "fas fa-sign-in",
                            requiresAuthentication: true
                        )
                    )
                    .AddItem(
                        new MenuItemDefinition(
                            PageNames.OutboundRubberFrameLogs,
                            L("OutboundRubberFrameLogs"),
                            url: "OutboundRubberFrameLogs",
                            icon: "fas fa-sign-out",
                            requiresAuthentication: true
                        )
                    )
                )
                /* 仓库管理菜单组（结束） */
                /* 系统管理菜单组（开始） */
                .AddItem( // Menu items below is just for demonstration!
                    new MenuItemDefinition(
                        "SystemManagement",
                        L("SystemManagement"),
                        icon: "fas fa-cogs"
                    )
                    .AddItem(
                        new MenuItemDefinition(
                            PageNames.Tenants,
                            L("Tenants"),
                            url: "Tenants",
                            icon: "fas fa-building",
                            permissionDependency: new SimplePermissionDependency(PermissionNames.Pages_Tenants)
                        )
                    )
                    .AddItem(
                        new MenuItemDefinition(
                            PageNames.Users,
                            L("Users"),
                            url: "Users",
                            icon: "fas fa-users",
                            permissionDependency: new SimplePermissionDependency(PermissionNames.Pages_Users)
                        )
                    )
                    .AddItem(
                        new MenuItemDefinition(
                            PageNames.Roles,
                            L("Roles"),
                            url: "Roles",
                            icon: "fas fa-theater-masks",
                            permissionDependency: new SimplePermissionDependency(PermissionNames.Pages_Roles)
                        )
                    )
                    .AddItem(
                        new MenuItemDefinition(
                            PageNames.WorkStations,
                            L("WorkStations"),
                            url: "WorkStations",
                            icon: "fas fa-users",
                            requiresAuthentication: true
                        )
                    )
                )
            /* 系统管理菜单组（结束） */
            //.AddItem(
            //    new MenuItemDefinition(
            //        PageNames.ProductionLines,
            //        L("ProductionLines"),
            //        url: "ProductionLines",
            //        icon: "fas fa-theater-masks",
            //        requiresAuthentication: true
            //    )
            //)
            ;
        }

        private static ILocalizableString L(string name)
        {
            return new LocalizableString(name, Boilerplate9Consts.LocalizationSourceName);
        }
    }
}